package ru.papergames.web.blines.battle.network.clientpackets;

import ru.papergames.common.form.NpcPlayerForm;
import ru.papergames.common.netutils.ModelWriterUtils;

import java.util.List;

/**
 * @author : atroshanin
 */
public class AddNewNpcPlayers extends WebServerClientPacket {

    private List<NpcPlayerForm> npcPlayers;

    public AddNewNpcPlayers(List<NpcPlayerForm> npcPlayers) {
        this.npcPlayers = npcPlayers;
    }

    @Override
    protected void writePacketId() {
        writeC(ADD_NPC_PLAYERS_PACKET_ID);
    }

    @Override
    protected void writePacketData() {
        writeD(npcPlayers.size());
        for (NpcPlayerForm npcPlayer : npcPlayers) {
            ModelWriterUtils.writePlayerToBuffer(_buf, npcPlayer);
        }
    }

    @Override
    public String getType() {
        return "[c] AddNewNpcPlayers[" + ADD_NPC_PLAYERS_PACKET_ID + "]";
    }
}
